package com.itgaoshu.hospitalproject.controller;
import com.itgaoshu.hospitalproject.bean.Drugstore;
import com.itgaoshu.hospitalproject.bean.Skull;
import com.itgaoshu.hospitalproject.bean.Upplier;
import com.itgaoshu.hospitalproject.bean.Warehuose;
import com.itgaoshu.hospitalproject.service.DrugstoreService;
import com.itgaoshu.hospitalproject.service.OutinstoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;
@Controller
//负责跳转页面controller
@RequestMapping("dsnavigation")
public class PathStoreController {
    @Autowired
    private DrugstoreService drugstoreService;
    @Autowired
    private OutinstoreService outinstoreService;
    //跳转到入库单
    @RequestMapping("beputinstorage")
    public Object beputinstorage(Upplier upplier, Warehuose warehuose, Skull skull, Model model){
        //跳转的同时查询供货商，经办人，库房进行回显
        List<Upplier> selupp = drugstoreService.selupplier(upplier);
        List<Skull> selsku = drugstoreService.selskull(skull);
        List<Warehuose> selwar = drugstoreService.selwarehuose(warehuose);
        model.addAttribute("selupp",selupp);
        model.addAttribute("selsku",selsku);
        model.addAttribute("selwar",selwar);
        return "drugstore/c_beputinstorage";
    }
    @RequestMapping("store")
    public Object store(){
        return "drugstore/c_store";
    }
    @RequestMapping("pharymacyhtml")
    public Object pharymaryhtml(){
        return "drugstore/c_pharmacy";
    }
    @RequestMapping("selectdurg")
    public Object selectdurg() {
        return "drugstore/c_selectDrug";
    }
    @RequestMapping("recycle")
    public Object recycle() {
        return "drugstore/c_recycle";
    }
    @RequestMapping("selectchuku")
    public Object selectchuku(Model model) {
        int selbaoquecount = outinstoreService.selbaoquecount();
        model.addAttribute("selbaoquecount",selbaoquecount);
        return "drugstore/c_gooutstore";
    }
   //药品日期报警
    @RequestMapping("seldrugDate")
    public Object seldrugDate(Drugstore drugstore, Model model) {
        int selcountlessnum = drugstoreService.selcountlessnum();
        model.addAttribute("selcountlessnum",selcountlessnum);
        return "drugstore/c_storedrugDate";
    }
    //药品报缺
    @RequestMapping("selectless")
    public Object selectless(Model model) {
        return "drugstore/c_lackdrug";
    }

    //进入操作记录页面
    @RequestMapping("record")
    public  Object record(){
        return "drugstore/c_record";
    }

}
